import AppResponse from "../types/response";


interface ResponseFunc {
    (o: object | null | string ) : AppResponse
}

interface ErrorFunc {
    (BizError): AppResponse
}

const Success: ResponseFunc = (payload) => ({
    code: 0,
    msg: 'success',
    data: payload
})

const Fail: ErrorFunc = (err) => ({
    code: err.code,
    data: null,
    msg: err.message
})

export {
    Success,
    Fail
}
